<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class HomeUserEditValidata extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
     public function rules()
     {
         return [
             'username' => 'required|min:2|max:16',
             'sex'      => 'required',
         ];
     }

     public function messages()
     {
         return [
             'username.required' => '用户名不能为空',
             'username.min'      => '用户名不能小于2',
             'username.max'      => '用户名不能大于16',
             'sex.required'      => '请选择性别',
         ];
     }
}
